package Java8实战._2_Stream_使用流._7_构建流;

import java.util.Arrays;
import java.util.stream.IntStream;

public class _2_由数组创建流 {

    public static void main(String[] args) {

        /**
         * 数字数组转成流
         */
        int[] ints = {1,2,3,4,5};
        IntStream intStream = Arrays.stream(ints);

        int sum = intStream.sum();
        System.out.println(sum);

        System.out.println("=============================");

        /**
         * 字符串数组转成流
         */
        String[] strings = {"jiang","bo","yang"};
        Arrays.stream(strings)
                .forEach(System.out::println);

    }


}
